package cn.bugstack.springframework.beans;

import java.util.ArrayList;
import java.util.List;

/**
 * @param
 * @author oyz
 * @version 1.0
 * @description: TODO 类的属性值集合
 * @date 2022/3/14 20:13
 */
public class PropertyValues {

    private List<PropertyValue> propertyValueList = new ArrayList<>();

    public void addPropertyValue(PropertyValue propertyValue){
        this.propertyValueList.add(propertyValue);
    }


    public PropertyValue[] getPropertyValues(){
        return this.propertyValueList.toArray(new PropertyValue[0]);
    }

    public PropertyValue getPropertyValue(String propertyName){
        for (PropertyValue pv : this.propertyValueList) {
            if(pv.getName().equals(propertyName)){
                return pv;
            }
        }
        return null;
    }


}
